// import React from "react";
import React from "./react";

function withTracker(OldComponent){
  return class Counter extends React.Component{
    constructor(props){
      super(props)
      this.state = {
        x:0,
        y:0
      }
    }
    handle = (event)=>{
      this.setState({
        x:event.clientX,
        y:event.clientY
      })
    }
     
      render(){
        return (
          <div onMouseMove = {this.handle}>
            <OldComponent {...this.state}/>
         </div>
        );
      }
  }
  
}

function Show(props){
  return (
    <React.Fragment>
      <h1>请移动鼠标</h1>
      <p>当前鼠标的位置是: x:{props.x} y:{props.y}</p>
    </React.Fragment>
)
}


let HighShow = withTracker(Show);
export default HighShow